package main

import (
	"flag"
	"fmt"
	"log"
	//    "github.com/gorilla/mux"
	//    "github.com/gorilla/securecookie"
	"ifms/http_servicer"
	"net/http"
	_ "net/http/pprof"
	"os"
	"time"
)

// will be initilized by build parameter
// -ldflags="-X main.version=$(git describe --always --long --dirty)"

var version string

func main() {
	flag.Parse()
	go func() {
		log.Println("pprof http server staring.... ", http.ListenAndServe("localhost:6067", nil), "  started")
	}()

	http_servicer.SetVersiton(version)

	time.Sleep(100 * time.Microsecond)

	fmt.Println("Server Started.... ")
	fmt.Printf("Version: %s\n", version)
	//http.ListenAndServe(":8000", nil)
	//	log.Fatal(http.ListenAndServe(":8007", http_servicer.MuxRouter()))
	log.Fatal(http.ListenAndServe(os.Getenv("HPRT"), http_servicer.MuxRouter()))

}
